package com.lry.config;

import com.lry.aspect.ExceptionNoticeAspect;
import com.lry.config.condition.EaEnableCondition;
import com.lry.handler.ExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
@Conditional(EaEnableCondition.class)
@ConditionalOnProperty(value = "ea.notice.type",havingValue = "common")
@Slf4j
public class EaCommonTypeConfig {


    @Bean
    @ConditionalOnMissingBean
    public ExceptionNoticeAspect exceptionNoticeAop(ExceptionHandler exceptionHandler) {
        log.debug("创建异常监听切面");
        ExceptionNoticeAspect aspect = new ExceptionNoticeAspect(exceptionHandler);
        return aspect;
    }


}
